<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*
        
            for in 遍历对象 


            for in 遍历数组-- 下标
            for of 遍历数组-- 元素
        */
        var arr = ['a', 'b', 'd', 'c'];
        for (var index in arr) {
            //index 下标（不包含length）
            console.log(index);//字符串 下标
            console.log(arr[index]);//元素
        }

        for (var value of arr) {
            // value是数组的元素
            console.log(value);
        }
    </script>

</body>

</html>